<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // 冒泡排序
        let arr = [12, 21, 23, 11, 2, 5, 15]
        for (let i = 0; i < arr.length; i++) {
            // console.log(arr[i]);
            for (let j = 0; j < arr.length; j++) {
                if (arr[i] < arr[j]) {
                    let temp = arr[i]
                    arr[i] = arr[j]
                    arr[j] = temp
                }
            }
        }
        console.log(arr);
    </script>
</body>


</html>